<html>
<head>
<meta charset="UTF-8">
<title>Entity - KBEngine cell</title>
<link href="../../style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td align=left style="background:#708090"> <font size=15 color=#ffffff> KBEngine </font></td></tr>
</table> <hr>
<h1>Entity</h1>

<p style="text-align: center;"><span class="module_h1">[<a href="../Modules/KBEngine.html" class="module_h1">KBEngine module</a>]</span></p>
<p>Entity is part of the <a href="../Modules/KBEngine.html">KBEngine</a> module. <a href="#detailed_description">More...</a></p><p></p><pre>import KBEngine</pre>

<h2><a href="#" onClick="obj=document.getElementById( 'functions' );vis = (obj.style.display == 'none') ? 'block' : 'none'; obj.style.display = vis; return false;" class="h2">Member functions</a></h2>
<table id="functions" cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr><td>
<span class="function_list">def <a href="#accelerate" class="function_list" >accelerate</a>( self, accelerateType, acceleration ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#addYawRotator" class="function_list" >addYawRotator</a>( self, targetYaw, velocity, userArg ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#addProximity" class="function_list" >addProximity</a>( self, range, userArg ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#addTimer" class="function_list" >addTimer</a>( self, start, interval=0.0, userData=0 ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#cancelController" class="function_list" >cancelController</a>( self, controllerID ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#clientEntity" class="function_list" >clientEntity</a>( self, destID  ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#canNavigate" class="function_list" >canNavigate</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#debugView" class="function_list" >debugView</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#delTimer" class="function_list" >delTimer</a>( self, id ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#destroy" class="function_list" >destroy</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#destroySpace" class="function_list" >destroySpace</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#entitiesInView" class="function_list" >entitiesInView</a>( self, pending):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#entitiesInRange" class="function_list" >entitiesInRange</a>( self, range, entityType=None, position=None ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#isReal" class="function_list" >isReal</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#moveToEntity" class="function_list" >moveToEntity</a>( self, destEntityID, velocity, distance, userData, faceMovement, moveVertically, offsetPos ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#moveToPoint" class="function_list" >moveToPoint</a>( self, destination, velocity, distance, userData, faceMovement, moveVertically ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#getViewRadius" class="function_list" >getViewRadius</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#getViewHystArea" class="function_list" >getViewHystArea</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#getRandomPoints" class="function_list" >getRandomPoints</a>( self, centerPos, maxRadius, maxPoints, layer ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#navigate" class="function_list" >navigate</a>( self, destination, velocity, distance, maxMoveDistance, maxSearchDistance, faceMovement, layer, userData ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#navigatePathPoints" class="function_list" >navigatePathPoints</a>( self,  destination, maxSearchDistance, layer ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#setViewRadius" class="function_list" >setViewRadius</a>( self, radius, hyst=5 ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#teleport" class="function_list" >teleport</a>( self, nearbyMBRef, position, direction ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#writeToDB" class="function_list" >writeToDB</a>( self, shouldAutoLoad, dbInterfaceName ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#getWitnesses" class="function_list" >getWitnesses</a>( self ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#getComponent" class="function_list" >getComponent</a>( self, componentName, all ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#fireEvent" class="function_list" >fireEvent</a>( self, eventName, *args ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#registerEvent" class="function_list" >registerEvent</a>( self, eventName, callback ):</span>
</td></tr>

<tr><td>
    <span class="function_list">def <a href="#deregisterEvent" class="function_list" >deregisterEvent</a>( self, eventName, callback ):</span>
</td></tr>

</table>

<h2><a href="#" onClick="obj=document.getElementById( 'callbacks' );vis = (obj.style.display == 'none') ? 'block' : 'none'; obj.style.display = vis; return false;" class="h2">Callbacks</a></h2>
<table id="callbacks" cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr><td>
<span class="function_list">def <a href="#onDestroy" class="function_list" >onDestroy</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onEnterTrap" class="function_list" >onEnterTrap</a>( self, entity, rangeXZ, rangeY, controllerID, userArg ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onEnteredView" class="function_list" >onEnteredView</a>( self, entity ):</span>
</td></tr>


<tr><td>
<span class="function_list">def <a href="#onGetWitness" class="function_list" >onGetWitness</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onLeaveTrap" class="function_list" >onLeaveTrap</a>( self, entity, rangeXZ, rangeY, controllerID, userArg ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onLoseControlledBy" class="function_list" >onLoseControlledBy</a>( self, id ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onLoseWitness" class="function_list" >onLoseWitness</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onMove" class="function_list" >onMove</a>( self, controllerID, userData ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onMoveOver" class="function_list" >onMoveOver</a>( self, controllerID, userData ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onMoveFailure" class="function_list" >onMoveFailure</a>( self, controllerID, userData ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onRestore" class="function_list" >onRestore</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onSpaceGone" class="function_list" >onSpaceGone</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onTurn" class="function_list" >onTurn</a>( self, controllerID, userData ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onTeleport" class="function_list" >onTeleport</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onTeleportFailure" class="function_list" >onTeleportFailure</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onTeleportSuccess" class="function_list" >onTeleportSuccess</a>( self, nearbyEntity ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onTimer" class="function_list" >onTimer</a>( self, timerHandle, userData ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onUpdateBegin" class="function_list" >onUpdateBegin</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onUpdateEnd" class="function_list" >onUpdateEnd</a>( self ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onWitnessed" class="function_list" >onWitnessed</a>( self, isWitnessed ):</span>
</td></tr>

<tr><td>
<span class="function_list">def <a href="#onWriteToDB" class="function_list" >onWriteToDB</a>( self ):</span>
</td></tr>

</table>

<h2><a href="#" onClick="obj=document.getElementById( 'attributes' );vis = (obj.style.display == 'none') ? 'block' : 'none'; obj.style.display = vis; return false;" class="h2">Attributes</a></h2>
<table id="attributes" cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><a href="#allClients" class="attribute_list" >allClients</a></td><td>&nbsp; Read-only PyClient
</td></tr>

<tr valign=top><td><a href="#base" class="attribute_list" >base</a></td><td>&nbsp; Read-only <a href=../../keywords.html#EntityCall>BaseEntityCall </a>
</td></tr>

<tr valign=top><td><a href="#client" class="attribute_list" >client</a></td><td>&nbsp; Read-only <a href=../../keywords.html#EntityCall>ClientEntityCall</a>
</td></tr>

<tr valign=top><td><a href="#controlledBy" class="attribute_list" >controlledBy</a></td><td>&nbsp; <a href=../../keywords.html#EntityCall>BaseEntityCall</a>
</td></tr>

<tr valign=top><td><a href="#className" class="attribute_list" >className</a></td><td>&nbsp; Read-only <a href="STRING.html">string</a>
</td></tr>

<tr valign=top><td><a href="#direction" class="attribute_list" >direction</a></td><td>&nbsp; Tuple of 3 floats as (roll, pitch, yaw)
</td></tr>

<tr valign=top><td><a href="#hasWitness" class="attribute_list" >hasWitness</a></td><td>&nbsp; boolean
</td></tr>

<tr valign=top><td><a href="#id" class="attribute_list" >id</a></td><td>&nbsp; Read-only Integer
</td></tr>

<tr valign=top><td><a href="#isDestroyed" class="attribute_list" >isDestroyed</a></td><td>&nbsp; Read-only bool
</td></tr>

<tr valign=top><td><a href="#isWitnessed" class="attribute_list" >isWitnessed</a></td><td>&nbsp; Read-only bool</td></tr>

<tr valign=top><td><a href="#layer" class="attribute_list" >layer</a></td><td>&nbsp; int8
</td></tr>

<tr valign=top><td><a href="#otherClients" class="attribute_list" >otherClients</a></td><td>&nbsp; Read-only PyClient
</td></tr>

<tr valign=top><td><a href="#position" class="attribute_list" >position</a></td><td>&nbsp; <a href=../../keywords.html#vector3>Vector3</a>
</td></tr>

<tr valign=top><td><a href="#spaceID" class="attribute_list" >spaceID</a></td><td>&nbsp; Read-only uint32
</td></tr>

<tr valign=top><td><a href="#topSpeed" class="attribute_list" >topSpeed</a></td><td>&nbsp; float
</td></tr>

<tr valign=top><td><a href="#topSpeedY" class="attribute_list" >topSpeedY</a></td><td>&nbsp; float
</td></tr>

<tr valign=top><td><a href="#volatileInfo" class="attribute_list" >volatileInfo</a></td><td>&nbsp; float
</td></tr>

</table>

<hr>
<a name="detailed_description"></a><h2>A detailed description</h2>
Instances of class <a href=../../keywords.html#entity>Entity</a> represent 
game objects in the cell.
An <a href=../../keywords.html#entity>Entity</a> can either be "real" or "ghosted".
A "ghost" <a href=../../keywords.html#entity>Entity</a> is a copy of a 
"real" <a href=../../keywords.html#entity>Entity</a> living on a neighboring cell.
There is a unique "real" <a href=../../keywords.html#entity>Entity</a> 
instance for each entity, and 0 or more "ghost" <a href=../../keywords.html#entity>Entity</a> 
instances.
<br><br>
An <a href=../../keywords.html#entity>Entity</a> instance controls the location 
data of the entity, including its position and rotation. It also controls 
how often this data is sent to the client (if possible). The location data 
can be updated by a unique client and modified by the controller object 
using the teleport member function. Controllers are non-python objects 
that can be used to change the location data over time on cell entities. 
They are added to <a href=../../keywords.html#entity>Entity</a> through 
member functions such as "trackEntity" and "turnToYaw" and can be removed 
via "cancelController".
<br><br>
Area of Interest or "View" is an important concept for all <a href="KBEngine.html">KBEngine</a>
entities that belong to a client. The view of an entity is the area that 
the client (if it has a client) can perceive around this entity.
This is used to select the amount of data sent to the client. The actual 
shape of the View is defined by the range of distances on the x-axis and 
around the z-axis, and there is a lag region that extends outward 
like a shape. An <a href=../../keywords.html#entity>Entity</a> enters 
another <a href=../../keywords.html#entity>Entity</a>'s view, but does 
not leave it until it leaves the lag area. An <a href=../../keywords.html#entity>Entity</a> 
can modify its View size via "setViewRadius". You can find all entities 
within a specific distance with "entitiesInRange" and set traps to capture 
all entities that enter the trap with "addProximity".
<br><br>
The new <a href=../../keywords.html#entity>Entity</a> on cellapp can be 
created using <a href="../Modules/KBEngine.html">KBEngine</a>.<a href=../Modules/KBEngine.html#createEntity>createEntity</a>. 
An entity can also be created by the baseapp remote calls to the <a href="../Modules/KBEngine.html">KBEngine</a>.<a href=../Modules/KBEngine.html#createCellEntity>createCellEntity</a> 
function.
<br><br>
An <a href=../../keywords.html#entity>Entity</a> can access it equivalent 
entities on the base and client applications via <a href=../../keywords.html#EntityCall>ENTITYCALL</a>. 
This requires a set of remotely-invoked functions (specified in the entity's .def file)

<hr>
<h2>Member function documentation</h2>

<a name="accelerate"></a><p class="function_definition">
<span class="function_definition">def accelerate( <i>self, accelerateType, acceleration</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Accelerate the current movement of the entity.
</div>

<p>
<span class="function_links"><b>The activities that can be accelerated include:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#moveToEntity">moveToEntity</a><br></td></tr>
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#moveToPoint">moveToPoint</a><br></td></tr>
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#navigate">navigate</a><br></td></tr>
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#addYawRotator">addYawRotator</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>accelerateType</i></span></td><td><span class="function_parameter_description">
string, the type of movement affected such as: "Movement", "Turn".
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>velocity</i></span></td><td><span class="function_parameter_description">
float, acceleration per second, use negative to decelerate
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
The current speed of the affected entity.
</td></tr>
</table>
</p>



<a name="addYawRotator"></a><p class="function_definition">
<span class="function_definition">def addYawRotator( <i>self, targetYaw, velocity, userArg</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
The control entity rotates around yaw. <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#onTurn>onTurn</a> is called when the rotation completes.
<br><br>
To remove it, use <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a> 
with the controller ID or use <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController("Movement")</a> 
to remove it.
</div>

<p>
<span class="function_links"><b>See:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#cancelController">cancelController</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>targetYaw</i></span></td><td><span class="function_parameter_description">
float, the given target yaw radians.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>velocity</i></span></td><td><span class="function_parameter_description">
float, the arc per second when rotated.<br>
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userArg</i></span></td><td><span class="function_parameter_description">
Optional integer that is common to all controllers. If this value is not 0, 
it is passed to the callback function. It is recommended to set the default 
value to 0 in the callback prototype.
</span></td></tr>

</table>
</p>




<a name="addProximity"></a><p class="function_definition">
<span class="function_definition">def addProximity( <i>self, rangeXZ, rangeY, userArg</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Create an area trigger that will notify the <a href=../../keywords.html#entity>Entity</a>
when other entities enter or leave the trigger area. This area is a square (for efficiency).<br><br>
If another entity is within a given distance on the x-axis and z-axis, 
it is considered to be within the range. This <a href=../../keywords.html#entity>Entity</a> 
is notified via the onEnterTrap and onLeaveTrap functions, which can be 
defined as follows:
<br><br>

<pre>
	def onEnterTrap( self, entityEntering, rangeXZ, rangeY, controllerID, userArg = 0 ):
	def onLeaveTrap( self, entityLeaving, rangeXZ, rangeY, controllerID, userArg = 0 ):
</pre>
<br><br>
Because the scope trigger is a controller, use <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a> 
with the controller ID to delete it.
<br><br>
It should be noted that the callback may be triggered immediately, even 
before the call to addProximity() returns.
</div>

<p>
<span class="function_links"><b>See:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#cancelController">cancelController</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>rangeXZ</i></span></td><td><span class="function_parameter_description">
float, the size of the xz axis area of the trigger, must be greater than or equal to zero.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>rangeY</i></span></td><td><span class="function_parameter_description">
float, the height of the y-axis of the trigger, must be greater than or equal to zero.<br>
It should be noted that for this parameter to take effect <a href=../../keywords.html#kbengine_defaults.xml>kbengine_defaults.xml</a>->cellapp->coordinate_system->rangemgr_y 
must be set to true.
<br>
Open y-axis management will increase CPU consumption, because some games 
have a large number of entities at the same y-axis height or all on the 
ground which is almost completely flat. Because of this, the collision 
becomes very dense.
<br>
3D space games or small room-type games are more suitable for this option.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userArg</i></span></td><td><span class="function_parameter_description">
Optional integer that is common to all controllers. If this value is not 0, 
it is passed to the callback function. It is recommended to set the default 
value to 0 in the callback prototype.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
The ID of the created controller.
</td></tr>
</table>
</p>

<a name="addTimer"></a><p class="function_definition">
<span class="function_definition">def addTimer( <i>self, start, interval=0.0, userData=0</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Register a timer. The timer triggers the callback function <i><a href="#onTimer">onTimer</a></i> 
The callback function will be executed the first time after "initialOffset" 
seconds, and then it will be executed once every "repeatOffset" seconds 
with the "userArg" parameter. (integer only)
<br><br>
The <i><a href="#onTimer">onTimer</a></i> function must be defined in the 
cell part of the entity with two parameters. The first is an integer, the 
timer's ID (which can be used to remove the timer's "<a href="#delTimer">delTimer</a>" 
function), and the second is the user parameter "userArg".
<br><br>
Example:

<pre><pre># Here is an example of using addTimer
import <a href="../Modules/KBEngine.html">KBEngine</a>
&nbsp;
class MyCellEntity( <a href="../Modules/KBEngine.html">KBEngine</a>.<a href=../../keywords.html#entity>Entity</a> ):
&nbsp;
    def __init__( self ):
        <a href="../Modules/KBEngine.html">KBEngine</a>.<a href=../../keywords.html#entity>Entity</a>.__init__( self )
&nbsp;
        # Add a timer, perform the first time after 5 seconds, and execute once every 1 second. The user parameter is 9.
        self.addTimer( 5, 1, 9 )
&nbsp;
        # Add a timer and execute it after 1 second. The default user parameter is 0.
        self.addTimer( 1 )
&nbsp;
    # <a href=../../keywords.html#entity>Entity</a> timer callback "onTimer" is called
    def onTimer( self, id, userArg ):
        print "MyCellEntity.onTimer called: id %i, userArg: %i" % ( id, userArg )
        # if this is a repeated timer, when it is no longer needed, call the following function to remove it:
        #     self.delTimer( id )</pre>
</pre>
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>initialOffset</i></span></td><td><span class="function_parameter_description">
float, specifies the time interval (in seconds) for the timer to execute the first callback.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>repeatOffset</i></span></td><td><span class="function_parameter_description">
float, specifies the time interval (in seconds) between each callback after 
the first callback. The timer must be removed with the function <a href="#delTimer">delTimer</a>, 
otherwise it will be repeated. Values less than or equal to 0 will be ignored.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userArg</i></span></td><td><span class="function_parameter_description">
integer, specifies the value of the "userArg" parameter when calling "<a href="#onTimer">onTimer</a>".
</span></td></tr>
</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>integer, returns the internal ID of the timer. This ID can be used 
to remove the timer using <a href="#delTimer">delTimer</a>.
</td></tr>
</table>
</p>




<a name="cancelController"></a><p class="function_definition">
<span class="function_definition">def cancelController( <i>self, controllerID</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
The function cancelController stops the effect of a controller on <a href=../../keywords.html#entity>Entity</a>. 
It can only be called on a <a href=../../keywords.html#real>real</a> entity.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">
integer, the index of the controller to cancel. 
A special controller type string can also be used as its type. 
For example, only one mobile/navigation controller can be activated at a 
time. This can be cancelled with entity.cancelController( "Movement" ).
</span></td></tr>

</table>
</p>



<a name="clientEntity"></a><p class="function_definition">
<span class="function_definition">def clientEntity( <i>self, destID</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This method can access the method of an entity in its own client 
(the current entity must be bound to the client). Only the entities in 
the View scope will be synchronized to the client. It can only be called 
on a <a href=../../keywords.html#real>real</a> entity.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>destID</i></span></td><td><span class="function_parameter_description">
integer, the ID of the target entity.
</span></td></tr>

</table>
</p>



<a name="canNavigate"></a><p class="function_definition">
<span class="function_definition">def canNavigate( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This method determines whether the current entity can use the navigation (<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#navigate>navigate</a>) 
feature. It can only be called on a <a href=../../keywords.html#real>real</a>
entity. <br>
Usually it can use navigation when the entity's Space uses <a href=../Modules/KBEngine.html>KBENgine</a>.<a href=../Modules/KBEngine.html#addSpaceGeometryMapping>addSpaceGeometryMapping</a> 
to load valid navigation collision data (Navmesh or 2D tile data) and the 
entity is available in the effective navigation area.
</div>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>bool, returns True if the entity can use the Navigate function 
in the current space, otherwise it returns False.
</td></tr>
</table>
</p>



<a name="debugView"></a><p class="function_definition">
<span class="function_definition">def debugView( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
debugView outputs the <a href=../../keywords.html#entity>Entity</a>'s View 
details to the cell's debug log. A description of the workings of the View 
system can be found in the <a href=../../keywords.html#entity>Entity</a> 
class documentation.
<br><br>
A sample of information is as follows:

<pre>  INFO cellapp [0x00001a1c] [2014-11-04 00:28:41,409] - Avatar::debugView: 100 size=4, Seen=4, Pending=0, ViewRadius=50.000, ViewHyst=5.000
  INFO cellapp [0x00001a1c] [2014-11-04 00:28:41,409] - Avatar::debugView: 100 Avatar(102), position(771.586.211.002.776.55), dist=0
  INFO cellapp [0x00001a1c] [2014-11-04 00:28:41,409] - Avatar::debugView: 100 Monster(1028), position(820.834.211.635.768.749), dist=49.8659
  INFO cellapp [0x00001a1c] [2014-11-04 00:28:41,409] - Avatar::debugView: 100 NPC(1025), position(784.024.210.95.782.273), dist=13.6915
  INFO cellapp [0x00001a1c] [2014-11-04 00:28:41,409] - Avatar::debugView: 100 Avatar(106), position(771.586.211.002.776.55), dist=0
</pre>
The first line of information tells us:
<ul>
<li>It is entity #1000's data.</li>
<li>There are 4 entities in its View area and all have been synchronized to the client.</li>
<li>There are 0 entities in its view Area that are waiting to be synchronized to the client.</li>
<li>The radius of the View is 50.000</li>
<li>The lag area of the View extends 5.000 outward.</li>
</ul>
</div>

<a name="delTimer"></a><p class="function_definition">
<span class="function_definition">def delTimer( <i>self, id</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
The delTimer function is used to remove a registered timer. The removed 
timer is no longer executed. Single shot timers are 
automatically removed after the callback is executed, and it is not 
necessary to use the delTimer to remove it. If the delTimer function 
uses an invalid ID (for example, it has been removed), an error will be 
generated.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>id</i></span></td><td><span class="function_parameter_description">
integer, which specifies the timer ID to remove. If the parameter is the string "All", all timers are removed at once.
</span></td></tr>

</table>
</p>

<a name="destroy"></a><p class="function_definition">
<span class="function_definition">def destroy( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function destroys its local <a href=../../keywords.html#entity>Entity</a>
instance. If the entity has a <a href=../../keywords.html#ghost>ghost</a> 
part on other processes, it will also notify for their destruction. This 
function is best called by the entity itself, and throws an exception if 
the entity is a <a href=../../keywords.html#ghost>ghost</a>. If the 
callback function onDestroy() is implemented, it is executed.
</div>

<a name="destroySpace"></a><p class="function_definition">
<span class="function_definition">def destroySpace( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Destroys the <a href=../../keywords.html#Space>space</a> this entity is in.
</div>

<a name="entitiesInView"></a><p class="function_definition">
<span class="function_definition">def entitiesInView( <i>self, pending</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Get a list of entities in the <a href=../../keywords.html#View>View</a> 
scope of this entity.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr valign=top><td><span class="function_parameter_name"><i>pending</i></span></td><td><span class="function_parameter_description">
bool, optional parameter, the default is False, only all entities visible to the client are returned, 
otherwise all entities visible to the server but not synchronized to the client are returned.
</span></td></tr>
</table>
</p>

<a name="entitiesInRange"></a><p class="function_definition">
<span class="function_definition">def entitiesInRange( <i>self, range, entityType=None, position=None</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Search for <a href="Entity.html">entities</a> within a given distance. 
This is a spherical search. The distances of the three axes must be 
measured. This can find <a href="Entity.html">entities</a> that are 
outside the <a href=../../keywords.html#View>View</a> scope of this 
entity, but cannot find entities in other <a href=../../keywords.html#cell>cells</a>.<br><br>

Example:
<pre>  self.entitiesInRange( 100, 'Creature', (100, 0, 100) )
</pre>
Searches for a list of entities of type 'Creature' (an instantiated entity 
of a subclass of 'Creature'). The center point is (100, 0, 100) and the 
search radius is 100 meters.

<pre>  [ e for e in self.entitiesInRange( 100, None, (100,0,100) ) if isinstance( e, BaseType ) ]
</pre>
Gives a list of entities instantiated from subclasses of 'BaseType'.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>range</i></span></td><td><span class="function_parameter_description">
Search distance around this entity, float type
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>entityType</i></span></td><td><span class="function_parameter_description">
An optional string parameter, the entity's type name, used to match entities. 
If the entity type is a valid class name (valid entities are ones listed in <res><a href=../../keywords.html#entities.xml>/scripts/entities.xml</a>) 
only this type of entity will be returned, otherwise all entities in this 
range will be returned.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>position</i></span></td><td><span class="function_parameter_description">
Optional <a href=../../keywords.html#vector3>Vector3</a> type parameter, 
which is the center of the search radius is centered on the entity itself 
by default.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
A list of <a href=../../keywords.html#entity>Entity</a> objects in a given range.
</td></tr>
</table>
</p>

<a name="isReal"></a><p class="function_definition">
<span class="function_definition">def isReal( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function returns whether the <a href=../../keywords.html#entity>Entity</a>
is <a href=../../keywords.html#real>real</a> or a <a href=../../keywords.html#ghost>ghost</a>.
<br><br>
This function is rarely used but is useful for debugging.
</div>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>bool, True if real, otherwise False.
</td></tr>
</table>
</p>

<a name="moveToEntity"></a><p class="function_definition">
<span class="function_definition">def moveToEntity( <i>self, destEntityID, velocity, distance, userData, faceMovement, moveVertically, offsetPos</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Moves the <a href="Entity.html">Entity</a> straight to another <a href=../../keywords.html#entity>Entity</a> position.<br>
Any <a href="Entity.html">Entity</a> can only have one motion controller 
at any time. Repeatedly calling any move function will terminate the previous 
move controller.<br>
This function will return a controller ID that can be used to cancel this move.<br>
<br>
For example, <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( movementID ). 
You can also cancel the move using <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( "Movement" ). 
The callback function will not be called if the move is cancelled.
<br><br>

<pre>
	def onMove( self, controllerID, userData ):
	def onMoveOver( self, controllerID, userData ):
	def onMoveFailure( self, controllerID, userData ):
</pre>
</div>

<p>
<span class="function_links"><b>References:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#cancelController">cancelController</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>destEntityID</i></span></td><td><span class="function_parameter_description">
int, the ID of the target <a href=../../keywords.html#entity>Entity</a>
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>velocity</i></span></td><td><span class="function_parameter_description">
float, speed of the <a href=../../keywords.html#entity>Entity</a> move, in m/s
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>distance</i></span></td><td><span class="function_parameter_description">
float, distance target that when reached the entity will stop moving, 
if the value is 0, it moves to the target position.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">
object, optional parameter, when the callback function is invoked the 
userData parameter will be this value.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>faceMovement</i></span></td><td><span class="function_parameter_description">
bool, optional parameter, True if the entity faces the direction of the move. 
If it is other mechanism, it is False.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>moveVertically</i></span></td><td><span class="function_parameter_description">
bool, optional parameter, set to True to move in a straight line, set to 
False means to move in a straight line parallel to the ground.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>offsetPos</i></span></td><td><span class="function_parameter_description">
Vector3, optional parameter, Set a certain offset value, such as moving the target position to the left of the entity.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
int, newly created controller ID.
</td></tr>
</table>
</p>

<a name="moveToPoint"></a><p class="function_definition">
<span class="function_definition">def moveToPoint( <i>self, destination, velocity, distance, userData, faceMovement, moveVertically</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Move the <a href=../../keywords.html#entity>Entity</a> to the given 
coordinate point in a straight line. The callback function is invoked on 
success or failure.<br>
Any <a href="Entity.html">Entity</a> can only have one motion controller 
at any time. Repeatedly calling any move function will terminate the 
previous move controller.<br>
Returns a controller ID that can be used to cancel this move.

<br><br>
For example:
<br><a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( movementID ).
You can also cancel the move with <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( "Movement" ).
The callback function will not be called if the move is cancelled.
<br><br>
The callback function is defined as follows:

<pre>
	def onMove( self, controllerID, userData ):
	def onMoveOver( self, controllerID, userData ):
	def onMoveFailure( self, controllerID, userData ):
</pre>
</div>

<p>
<span class="function_links"><b>See:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#cancelController">cancelController</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>destination</i></span></td><td><span class="function_parameter_description">
Vector3, the target point to which the <a href=../../keywords.html#entity>Entity</a> 
is to be moved</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>velocity</i></span></td><td><span class="function_parameter_description">
float, <a href=../../keywords.html#entity>Entity</a>'s moving speed, in m/s</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>distance</i></span></td><td><span class="function_parameter_description">
float, distance target that when reached the entity will stop moving, 
if the value is 0, it moves to the target position.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">
object, data passed to the callback function
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>faceMovement</i></span></td><td><span class="function_parameter_description">
bool, True if the entity faces the direction of the move. If it is other mechanism, it is false.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>moveVertically</i></span></td><td><span class="function_parameter_description">
bool, set to True to move in a straight line, set to 
False means to move in a straight line parallel to the ground.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
int, newly created controller ID.
</td></tr>
</table>
</p>



<a name="getViewRadius"></a><p class="function_definition">
<span class="function_definition">def getViewRadius( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function returns the current View radius value of this <a href=../../keywords.html#entity>Entity</a>.
<br><br>
Data can be set via 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#setViewRadius>setViewRadius</a>( radius, hyst ).
</div>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>float, View radius
</td></tr>
</table>
</p>



<a name="getViewHystArea"></a><p class="function_definition">
<span class="function_definition">def getViewHystArea( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function returns the current lag area value of this <a href=../../keywords.html#entity>Entity</a> View.
<br><br>
Data can be set via 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#setViewRadius>setViewRadius</a>( radius, hyst ).
</div>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>float, The current lag area value of this Entity's View.
</td></tr>
</table>
</p>



<a name="getRandomPoints"></a><p class="function_definition">
<span class="function_definition">def getRandomPoints( <i>self, centerPos, maxRadius, maxPoints, layer</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function is used to get an array of random coordinate point that 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#navigate>navigate</a> 
can reach in a certain area centered on a certain coordinate point.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>centerPos</i></span></td><td><span class="function_parameter_description">
Vector3, <a href=../../keywords.html#entity>Entity</a> center coordinates
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>maxRadius</i></span></td><td><span class="function_parameter_description">
float, the maximum search radius
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>maxPoints</i></span></td><td><span class="function_parameter_description">
uint32, the maximimum number of random coordinate points returned.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>layer</i></span></td><td><span class="function_parameter_description">
int8, layer of navmesh to search.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
tuple, an array of one or more coordinates.
</td></tr>
</table>
</p>



<a name="navigate"></a><p class="function_definition">
<span class="function_definition">def navigate( <i>self, destination, velocity, distance, maxMoveDistance, maxSearchDistance, faceMovement, layer, userData</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Use the navigation system to move this <a href=../../keywords.html#entity>Entity</a> 
to a target point. A callback will be invoked on success or failure. <br>
<a href="KBEngine.html">KBEngine</a> can have several pre-generated 
navigation meshes with different mesh sizes (leading to different navigation paths).<br>
Any <a href="Entity.html">Entity</a> can only have one motion controller 
at any time. Repeatedly calling any move function will terminate the 
previous move controller.<br>
Returns a controller ID that can be used to cancel this move.

<br><br>For example:
<br><a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( movementID ).
You can also cancel the movement controller with <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#cancelController>cancelController</a>( "Movement" ). 
The callback function will not be called if the move is cancelled.
<br><br>
The callback functions are defined as follows:

<pre>
	def onMove( self, controllerID, userData ):
	def onMoveOver( self, controllerID, userData ):
	def onMoveFailure( self, controllerID, userData ):
</pre>
</div>

<p>
<span class="function_links"><b>See:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#cancelController">cancelController</a><br></td></tr>
</table>
</p>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>destination</i></span></td><td><span class="function_parameter_description">
Vector3, the target point where the <a href=../../keywords.html#entity>Entity</a> moves.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>velocity</i></span></td><td><span class="function_parameter_description">
float, <a href=../../keywords.html#entity>Entity</a>'s move speed, in m/s
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>distance</i></span></td><td><span class="function_parameter_description">
float, distance target that when reached the entity will stop moving, if the value is 0, it moves to the target position.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>maxMoveDistance</i></span></td><td><span class="function_parameter_description">
float, the maximum move distance
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>maxSearchDistance</i></span></td><td><span class="function_parameter_description">
float, the maximum search distance from the navigatio ndata.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>faceMovement</i></span></td><td><span class="function_parameter_description">
bool, True if the entity faces the direction of the move (default). Otherwise False.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>layer</i></span></td><td><span class="function_parameter_description">
int8, navmesh layer to search
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">
object, the data passed to the callback function
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
int, the newly created controller ID.
</td></tr>
</table>
</p>




<a name="navigatePathPoints"></a><p class="function_definition">
<span class="function_definition">def navigatePathPoints( <i>self, destination, maxSearchDistance, layer</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This functions returns a list of path points from the current <a href=../../keywords.html#entity>Entity</a> 
location to the destination.
<br><br>
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>destination</i></span></td><td><span class="function_parameter_description">
Vector3, target point where the <a href=../../keywords.html#entity>Entity</a> moves
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>maxSearchDistance</i></span></td><td><span class="function_parameter_description">
float, the maximum search distance
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>layer</i></span></td><td><span class="function_parameter_description">
int8, navmesh layer to search for a path on.
</span></td></tr>

</table>
</p>



<a name="setViewRadius"></a><p class="function_definition">
<span class="function_definition">def setViewRadius( <i>self, radius, hyst=5</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Specifies the size of the <a href=../../keywords.html#entity>Entity</a>'s 
<a href=../../keywords.html#View>View</a>.
<br><br>
This function can only be used by <a href=../../keywords.html#Witness>Witness</a> related entities.
<br><br>
Note: You can set the default View radius by setting the <a href=../../keywords.html#kbengine.xml>kbengine.xml</a> 
configuration option 'cellapp/defaultViewRadius'.
<br><br>
The View radius can't be greater than 500.0 by default. For details, please see the <a href=../../keywords.html#kbengine_defaults.xml>kbengine_defaults.xml</a> 
configuration option 'cellapp/entity_posdir_updates'.
<br><br>
Data can be obtained with <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#getViewRadius>getViewRadius</a>( ) and <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#getViewHystArea>getViewHystArea</a>( ).
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>radius</i></span></td><td><span class="function_parameter_description">
float, specifies the radius of the View area
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>hyst</i></span></td><td><span class="function_parameter_description">
float, specifies the size of the lag area of the View. A reasonable 
setting of the lag area will reduce the sensitivity of View collisions 
and reduce CPU consumption. Views where one entity 
enters another entity must span the View radius area, but entities that 
leave the View area need to move out of the View radius area including 
the lag area.
</span></td></tr>

</table>
</p>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
None
</td></tr>
</table>
</p>

<a name="teleport"></a><p class="function_definition">
<span class="function_definition">def teleport( <i>self, nearbyMBRef, position, direction</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Instantly move an <a href=../../keywords.html#entity>Entity</a> to a 
specified space. This function allows you to specify the position and 
orientation of the entity after is has been moved. <br>
If you need to jump in different <a href=../../keywords.html#Space>spaces</a> 
(usually for different scene or room jumps), you can pass a <a href=../../keywords.html#EntityCall>CellEntityCall</a> 
to this function (the entity corresponding to the entityCall must be 
in the destination <a href=../../keywords.html#Space>Space</a>).
<br><br>
This function can only be called on <a href=../../keywords.html#real>real</a> 
entities.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>nearbyMBRef</i></span></td><td><span class="function_parameter_description">
A <a href=../../keywords.html#EntityCall>CellEntityCall</a> (the entity 
corresponding to this entityCall must be in the destination <a href=../../keywords.html#Space>Space</a> ) 
that determines which <a href=../../keywords.html#Space>Space</a> an <a href=../../keywords.html#entity>Entity</a> 
is to jump to. It is considered to be the transfer destination. This can 
be set to None, in which case it will teleport on the current cell.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>position</i></span></td><td><span class="function_parameter_description">
A sequence of 3 floats (x, y, z), the coordinates of where to teleport the <a href=../../keywords.html#entity>Entity</a> .
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>direction</i></span></td><td><span class="function_parameter_description">
A sequence of 3 floats (roll, pitch, yaw), the orientation of the <a href=../../keywords.html#entity>Entity</a> 
after teleportation.
</span></td></tr>

</table>
</p>




<a name="writeToDB"></a><p class="function_definition">
<span class="function_definition">def writeToDB( <i>self, shouldAutoLoad, dbInterfaceName</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function saves the data related to this entity to the database, 
including the data of the base entity. The onWriteToDB function of the 
base entity is called before the data is passed to the database.
<br><br>
The data of the cell entity is also backed up in the base entity to 
ensure that the data is up-to-date when crash recovery data is encountered
<br><br>
This function can only be called on <a href=../../keywords.html#real>real</a> 
entities, and the entity must exist in the base section.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>shouldAutoLoad</i></span></td><td><span class="function_parameter_description">
bool, optional parameter, specifies whether this entity needs to be 
loaded from the database when the service starts.<br>
Note: The entity is automatically loaded when the server starts. The 
default is to call createEntityAnywhereFromDBID to create an entity to a 
minimally loaded baseapp. The entire process will be completed before the 
first started baseapp calls onBaseAppReady.<br>
<br>The script layer can reimplement the entity creation method in a 
customized script (kbengine_defaults.xml->baseapp->entryScriptFile definition), 
for example:<br>
def onAutoLoadEntityCreate(entityType, dbid): <br>
    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;KBEngine.createEntityFromDBID(entityType, dbid)<br>
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>dbInterfaceName</i></span></td><td><span class="function_parameter_description">
string, optional parameter, specified by a database interface, uses the 
interface name "default" by default. The database interface is defined in 
kbengine_defaults.xml->dbmgr->databaseInterfaces.
</span></td></tr>

</table>
</p>



<a name="getWitnesses"></a><p class="function_definition">
<span class="function_definition">def getWitnesses( <i>self</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function returns all other entities(Players) that observe this <a href=../../keywords.html#entity>Entity</a>. <br>
<br>
</div>

<p>
<span class="function_return">returns:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>
tuple, an array of zero or more <a href=../../keywords.html#entity>Entity</a>.
</td></tr>
</table>
</p>



<a name="getComponent"></a><p class="function_definition">
<span class="function_definition">def getComponent( <i>self, componentName, all</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Gets a component instance of the specified type attached to the entity.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>componentName</i></span></td><td><span class="function_parameter_description">
string, The component type name.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>all</i></span></td><td><span class="function_parameter_description">
bool, if True, Returns all instances of the same type of component, otherwise only returns the first or empty list.
</span></td></tr>
</table>
</p>


<a name="fireEvent"></a><p class="function_definition">
<span class="function_definition">def fireEvent( <i>self, eventName, *args</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Trigger entity events.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>eventName</i></span></td><td><span class="function_parameter_description">
string, the name of the event to trigger.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>args</i></span></td><td><span class="function_parameter_description">
The event datas to be attached, variable parameters.
</span></td></tr>
</table>
</p>


<a name="registerEvent"></a><p class="function_definition">
<span class="function_definition">def registerEvent( <i>self, eventName, callback</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Register entity events.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>eventName</i></span></td><td><span class="function_parameter_description">
string, the name of the event to be registered for listening.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>callback</i></span></td><td><span class="function_parameter_description">
The callback method used to respond to the event when the event fires.
</span></td></tr>
</table>
</p>


<a name="deregisterEvent"></a><p class="function_definition">
<span class="function_definition">def deregisterEvent( <i>self, eventName, callback</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
Deregister entity events.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>eventName</i></span></td><td><span class="function_parameter_description">
string, the name of the event to be deregister.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>callback</i></span></td><td><span class="function_parameter_description">
The callback method to deregister of the listener.
</span></td></tr>
</table>
</p>


<hr>
<h2>Callback functions documentation</h2>


<a name="onDestroy"></a><p class="function_definition">
<span class="function_definition">def onDestroy( <i>self</i> ):</span>
</p>

<div class="function_description">If this function is implemented in a 
script, it is called after <a href="Entity.html">Entity</a>.<a href=Entity.html#destroy>destroy</a>() 
destroys this entity. This function has no parameters.
</div>

<a name="onEnterTrap"></a><p class="function_definition">
<span class="function_definition">def onEnterTrap( <i>self, entity, rangeXZ, rangeY, controllerID, userArg</i> ):</span>
</p>

<div class="function_description">
When a scope trigger is registered using <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#addProximity>addProximity</a> 
and another entity enters the trigger, this callback function is called. 
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>entity</i></span></td><td><span class="function_parameter_description">
Entity that has entered the area
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>rangeXZ</i></span></td><td><span class="function_parameter_description">
float, the size of the xz axis of the trigger, must be greater than or equal to zero.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>rangeY</i></span></td><td><span class="function_parameter_description">
float, the size of the y-axis height of the trigger, must be greater than 
or equal to zero.<br>
It should be noted that for this parameter to take effect you must enable 
<a href=../../keywords.html#kbengine_defaults.xml>kbengine_defaults.xml</a>->cellapp->coordinate_system->rangemgr_y
<br>
Opening y-axis management will increase CPU consumption, because some games 
have a large number of entities at the same y-axis height or on the ground 
at nearly the same height. Because of this, the collision becomes very dense.<br>
3D space games or small room-type games are more suitable for enabling this 
option.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">&nbsp;The controller id of this trigger.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userArg</i></span></td><td><span class="function_parameter_description">
The value of the parameter given by the user when calling <a href=Entity.html#addProximity>addProximity</a>, 
the user can decide how to use this parameter.
</span></td></tr>

</table>
</p>

<a name="onEnteredView"></a><p class="function_definition">
<span class="function_definition">def onEnteredView( <i>self, entity</i> ):</span>
</p>

<div class="function_description">If this function is implemented in a 
script, when an entity enters the <a href=../../keywords.html#View>View</a> 
scope of the current entity, this callback is triggered.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>entity</i></span></td><td><span class="function_parameter_description">&nbsp;
The entity which has entered the View scope.
</span></td></tr>

</table>
</p>


<a name="onGetWitness"></a><p class="function_definition">
<span class="function_definition">def onGetWitness( <i>self</i> ):</span>
</p>

<div class="function_description">If this function is implemented in a script, 
it is called when the entity has a <a href=../../keywords.html#Witness>Witness</a> 
bound to it.<br>
You can also access the entity property <a href=#hasWitness>Entity.hasWitness</a> 
to get the current state of the entity.

</div>

<a name="onLeaveTrap"></a><p class="function_definition">
<span class="function_definition">def onLeaveTrap( <i>self, entity, rangeXZ, rangeY, controllerID, userArg</i> ):</span>
</p>

<div class="function_description">If this function is implemented in a 
script, it is triggered when an entity leaves the trigger area registered 
by the current entity. The scope trigger is registered with <a href=../../keywords.html#entity>Entity</a>.<a href=#addProximity>addProximity</a>.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>entity</i></span></td><td><span class="function_parameter_description">
The entity that has left the trigger area.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>rangeXZ</i></span></td><td><span class="function_parameter_description">
float, the size of the xz axis of the trigger, must be greater than or equal to zero.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>rangeY</i></span></td><td><span class="function_parameter_description">
float, the size of the y-axis height of the trigger, must be greater than 
or equal to zero.<br>
It should be noted that for this parameter to take effect you must enable 
<a href=../../keywords.html#kbengine_defaults.xml>kbengine_defaults.xml</a>->cellapp->coordinate_system->rangemgr_y
<br>
Opening y-axis management will increase CPU consumption, because some games 
have a large number of entities at the same y-axis height or on the ground 
at nearly the same height. Because of this, the collision becomes very dense.<br>
3D space games or small room-type games are more suitable for enabling this 
option.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">&nbsp;
The controller ID of this trigger.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userArg</i></span></td><td><span class="function_parameter_description">
The value of the parameter given by the user when calling <a href=Entity.html#addProximity>addProximity</a>, 
the user can decide how to use this parameter.
</span></td></tr>

</table>
</p>



<a name="onLoseControlledBy"></a><p class="function_definition">
<span class="function_definition">def onLoseControlledBy( <i>self, id</i> ):</span>
</p>

<div class="function_description">If this function is implemented in a 
script, this callback is triggered when this entity loses the <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#controlledBy >controlledBy</a>
entity.<br>
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>id</i></span></td><td><span class="function_parameter_description">&nbsp;
ID of the controlledBy entity.
</span></td></tr>

</table>
</p>



<a name="onLoseWitness"></a><p class="function_definition">
<span class="function_definition">def onLoseWitness( <i>self</i> ):</span>
</p>

<div class="function_description">If this function is implemented in a 
script, the callback is triggered whe this entity loses a <a href=../../keywords.html#Witness>Witness</a>.<br>
You can also access that <a href=#hasWitness>Entity.hasWitness</a> property 
to get the current state.
</div>

<a name="onMove"></a><p class="function_definition">
<span class="function_definition">def onMove( <i>self, controllerID, userData</i> ):</span>
</p>

<div class="function_description">If this function is implemented in the 
script, the callback is invoked each frame when moved after a call to <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#moveToPoint>moveToPoint</a>, 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#moveToEntity>moveToEntity</a>, or 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#navigate>navigate</a>. 

</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">&nbsp;
The controller ID associated with the move.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">&nbsp;
The parameter given by the user when requesting to move the entity.
</span></td></tr>

</table>
</p>



<a name="onMoveOver"></a><p class="function_definition">
<span class="function_definition">def onMoveOver( <i>self, controllerID, userData</i> ):</span>
</p>

<div class="function_description"> If this callback function is implemented in a 
script, it is invoked after a call to <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#moveToPoint>moveToPoint</a>, 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#moveToEntity>moveToEntity</a>, or 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#navigate>navigate</a> 
 when this entity reaches the target point.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">&nbsp;
The controller ID associated with the move.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">&nbsp;
This parameter value is given by the user when requesting to move an entity.
</span></td></tr>

</table>
</p>



<a name="onMoveFailure"></a><p class="function_definition">
<span class="function_definition">def onMoveFailure( <i>self, controllerID, userData</i> ):</span>
</p>

<div class="function_description">If this function is implemented in the 
script, this callback is invoked after a call to <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#moveToPoint>moveToPoint</a>, 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#moveToEntity>moveToEntity</a>, or 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#navigate>navigate</a> 
if the movement has failed.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">&nbsp;
The controller ID associated with the move.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">&nbsp;
This parameter value is given by the user when requesting to move an entity.
</span></td></tr>

</table>
</p>




<a name="onRestore"></a><p class="function_definition">
<span class="function_definition">def onRestore( <i>self</i> ):</span>
</p>

<div class="function_description"> If this callback function is implemented in a 
script, it is invoked when the Cell application crashes and recreates 
the entity on another cellapp. This function has no arguments.
</div>


<a name="onSpaceGone"></a><p class="function_definition">
<span class="function_definition">def onSpaceGone( <i>self</i> ):</span>
</p>

<div class="function_description">If this callback function is implemented in the 
script, it will be called when the current entity's <a href=../../keywords.html#Space>Space</a> 
is destroyed. This function has no parameters.
</div>



<a name="onTurn"></a><p class="function_definition">
<span class="function_definition">def onTurn( <i>self, controllerID, userData</i> ):</span>
</p>

<div class="function_description">If this callback function is implemented 
in a script, it will be called after reaching the specified yaw. (related to 
<a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#addYawRotator>addYawRotator</a>)<br>
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>controllerID</i></span></td><td><span class="function_parameter_description">&nbsp;
The controller ID returned by <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#addYawRotator>addYawRotator</a>.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">&nbsp;
This parameter value is given by user when requesting to move an entity.
</span></td></tr>

</table>
</p>


<a name="onTeleport"></a><p class="function_definition">
<span class="function_definition">def onTeleport( <i>self</i> ):</span>
</p>

<div class="function_description">If this callback  function is implemented 
in a script, it will be called at the moment before the (Real) entity is 
transmitted in the entity transfer that occurs through the baseapp's 
Entity.teleport call.<br>
Note: Calling teleport on the entity's cell section does not trigger 
this callback, if you need this feature please invoke this callback after 
a call to <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#teleport>teleport</a>.
</div>



<a name="onTeleportFailure"></a><p class="function_definition">
<span class="function_definition">def onTeleportFailure( <i>self</i> ):</span>
</p>

<div class="function_description">If this callback function is implemented in a 
script, it will be called after a call to <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#teleport>teleport</a> 
if the teleport has failed.
</div>


<a name="onTeleportSuccess"></a><p class="function_definition">
<span class="function_definition">def onTeleportSuccess( <i>self, nearbyEntity</i> ):</span>
</p>

<div class="function_description">If this callback function is implemented 
in a script, it is invoked after a succesful call to <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#teleport>teleport</a>
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>nearbyEntity</i></span></td><td><span class="function_parameter_description">&nbsp;
This parameter is given by the user when calling <a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#teleport>teleport</a>. 
This is a real entity.
<br><br>

</table>
</p>

<a name="onTimer"></a><p class="function_definition">
<span class="function_definition">def onTimer( <i>self, timerHandle, userData</i> ):</span>
</p>

<div class="function_description">
<b>Function description:</b><br><br>
This function is called when a timer associated with this entity is triggered. 
A timer can be added using the <a href=../../keywords.html#entity>Entity</a>.<a href=#addTimer>addTimer</a> function.
</div>

<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>timerHandle</i></span></td><td><span class="function_parameter_description">
The ID of the timer.
</span></td></tr>

<tr valign=top><td><span class="function_parameter_name"><i>userData</i></span></td><td><span class="function_parameter_description">
integer, given by the user when calling <a href=../../keywords.html#entity>Entity</a>.<a href=#addTimer>addTimer</a>.
</span></td></tr>

</table>
</p>



<a name="onUpdateBegin"></a><p class="function_definition">
<span class="function_definition">def onUpdateBegin( <i>self</i> ):</span>
</p>

<div class="function_description">Invoked when a synchronization frame begins.
</div>



<a name="onUpdateEnd"></a><p class="function_definition">
<span class="function_definition">def onUpdateEnd( <i>self</i> ):</span>
</p>

<div class="function_description">Invoked after a synchronization frame 
has completed.
</div>



<a name="onWitnessed"></a><p class="function_definition">
<span class="function_definition">def onWitnessed( <i>self, isWitnessed</i> ):</span>
</p>

<div class="function_description">If this callback function is implemented 
in a script, it is called when this entity enters the View area of 
another entity bound to a Witness (also can be understood as when this 
entity is observed by a client). This function can be used to activate 
the entity's AI when it is observed, and stopping AI execution when the 
entity ceases to be observed, thus reducing CPU consumption of the server 
to increase efficiency.
</div>



<p>
<span class="function_parameter">parameters:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">

<tr valign=top><td><span class="function_parameter_name"><i>isWitnessed</i></span></td><td><span class="function_parameter_description">&nbsp;
bool, True if the entity is observed and False when the entity is not 
observed.<br>
You can also access the entity property <a href=#isWitnessed>Entity.isWitnessed</a> 
to get the current state of the entity.
</span></td></tr>

</table>
</p>

<a name="onWriteToDB"></a><p class="function_definition">
<span class="function_definition">def onWriteToDB( <i>self</i> ):</span>
</p>

<div class="function_description">If this callback function is implemented 
in a script, it is called when the entity is about to be archived into 
the database.
</div>

<hr>
<h2>Attributes documentation</h2>

<a name="allClients"></a><p class="attribute_definition">
<span class="attribute_definition">allClients</span>
</p>

<div class="attribute_description">By calling the entity's remote client 
methods through this attribute, the engine broadcasts the message to all 
other entities bound to a client that are within this entity's View area 
(including its own client, and the entity bound to the client is usually 
the player)<br>
<br>
Example:<br>
Avatar has player A, player B, and monster C in the View range.<br>
avatar.allClients.attack(monsterID, skillID, damage)<br><br>
At this point, the player himself, player A's, and player B's clients will 
all call the entity's attack method, and their client can invoke the 
specified skill's attack action to perform.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#clientEntity">clientEntity</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#otherClients">otherClients</a><br></td></tr>
</table>
</p>



<a name="base"></a><p class="attribute_definition">
<span class="attribute_definition">base</span>
</p>

<div class="attribute_description">base is the entityCall used to contact 
the base <a href=../../baseapp/Classes/Entity.html>Entity</a>. This attribute 
is read-only and is None if the entity has no associated base <a href=../../baseapp/Classes/Entity.html>Entity</a>.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#clientEntity">clientEntity</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#allClients">allClients</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#otherClients">otherClients</a><br></td></tr>
</table>
</p>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, <a href=../../keywords.html#EntityCall>ENTITYCALL</a>
</td></tr>
</table>
</p>



<a name="className"></a><p class="attribute_definition">
<span class="attribute_definition">className</span>
</p>

<div class="attribute_description">The class name of the entity.
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, string
</td></tr>
</table>
</p>

<a name="client"></a><p class="attribute_definition">
<span class="attribute_definition">client</span>
</p>

<div class="attribute_description">client is the entityCall used to contact 
associated client. This attribute is read-only, and is None if this entity 
does not have an associated client.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#clientEntity">clientEntity</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#allClients">allClients</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#otherClients">otherClients</a><br></td></tr>
</table>
</p>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, <a href=../../keywords.html#EntityCall>ENTITYCALL</a>
</td></tr>
</table>
</p>



<a name="controlledBy"></a><p class="attribute_definition">
<span class="attribute_definition">controlledBy</span>
</p>

<div class="attribute_description">If this attribute is set to the 
BaseEntityCall of the server-side entity associated with a client, this 
entity is controlled by the corresponding client to move. If the attribute 
is None, the entity is moved by the server. When the client logs in and 
calls giveClientTo on this entity, this attribute is automatically set to 
its own BaseEntityCall.<br>
Scripts can flexibly control the movement of the entity by the server or 
by the client (its own client or give control to other clients).
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#onLoseControlledBy">onLoseControlledBy</a></td></tr>
</table>
</p>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#EntityCall>BaseEntityCall </a>
</td></tr>
</table>
</p>



<a name="direction"></a><p class="attribute_definition">
<span class="attribute_definition">direction</span>
</p>

<div class="attribute_description">This attribute describes the orientation 
of the <a href=../../keywords.html#entity>Entity</a> in world space. Users 
can change this attribute and the data will be synchronized to the client.
</div>

Example:

self.direction.y = 1.0
self.direction.z = 1.0


<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Vector3, which contains (roll, pitch, yaw) in radians.
</td></tr>
</table>
</p>



<a name="hasWitness"></a><p class="attribute_definition">
<span class="attribute_definition">hasWitness</span>
</p>

<div class="attribute_description">If this read-only attribute is True, 
it means that the entity has already bound a <a href=../../keywords.html#Witness>Witness</a>. 
If the entity is bound to <a href=../../keywords.html#Witness>Witness</a>, 
the client can obtain information from the entity's view scope. Otherwise, False.
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, bool 
</td></tr>
</table>
</p>

<a name="id"></a><p class="attribute_definition">
<span class="attribute_definition">id</span>
</p>

<div class="attribute_description">id is the id of the <a href=../../keywords.html#entity>Entity</a> 
object. This id is an integer that is the same between base, cell, 
and client associated entities. This attribute is read-only.
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, int32 
</td></tr>
</table>
</p>

<a name="isDestroyed"></a><p class="attribute_definition">
<span class="attribute_definition">isDestroyed</span>
</p>

<div class="attribute_description">If this attribute is True, this <a href=../../keywords.html#entity>Entity</a> 
has already been destroyed.
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, bool
</td></tr>
</table>
</p>



<a name="isOnGround"></a><p class="attribute_definition">
<span class="attribute_definition">isOnGround</span>
</p>

<div class="attribute_description">If the value of this attribute is True, 
the <a href=../../keywords.html#entity>Entity</a> is on the ground, otherwise 
it is False.
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, bool
</td></tr>
</table>
</p>


<a name="isWitnessed"></a><p class="attribute_definition">
<span class="attribute_definition">isWitnessed</span>
</p>

<div class="attribute_description">If the current entity is in the View 
scope of another entity bound to Witness (can also be understood as an
 entity observed by a client), this property is True, otherwise it is False.
<br><br>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href=Entity.html#onWitnessed>onWitnessed</a></td></tr>
</table>
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, bool 
</td></tr>
</table>
</p>


<a name="layer"></a><p class="attribute_definition">
<span class="attribute_definition">layer</span>
</p>

<div class="attribute_description">A space can load multiple navmesh data 
at the same time. Different navmesh can be in different layers. Different 
layers can be abstracted into the ground, the water surface, and so on. 
This attribute determines which layer an entity exists in.
<br><br>
Reference:<br>
<a href=../Modules/KBEngine.html#addSpaceGeometryMapping>KBEngine.addSpaceGeometryMapping</a>
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>int8 
</td></tr>
</table>
</p>



<a name="otherClients"></a><p class="attribute_definition">
<span class="attribute_definition">otherClients</span>
</p>

<div class="attribute_description">By calling the entity's remote client 
methods through this property, the engine broadcasts the message to all 
other entities bound to the cliend within this entity's View scope (Not 
including its own client. The entity bound to the client is usually the player.).
<br><br>
Example:<br>
avatar has player A, player B, and monster C in the View range.<br>
avatar.otherClients.attack(monsterID, skillID, damage)
<br><br>
At this point, player A's and player B's client will call the entity 
attack method, and their client can invoke the specified skill's attack 
action to perform.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#clientEntity">clientEntity</a><br><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#otherClients">otherClients</a><br></td></tr>
</table>
</p>



<a name="position"></a><p class="attribute_definition">
<span class="attribute_definition">position</span>
</p>

<div class="attribute_description">The coordinates of this entity in world 
space (x, y, z). This attribute can be changed by the user and will be 
synchronized to the client after the change. It is important to note that this 
attribute should not be referenced. Referencing this attribute is likely 
to incorrectly modify the real coordinates of the entity.
<br><br>

Example:
<pre>self.position.y = 10.0
</pre>
<br><br>
If you want to copy this attribute value you can do the following:
<br>
<pre>
	import Math
	self.copyPosition = Math.<a href=../../keywords.html#vector3>Vector3</a>( self.position )
</pre>
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#vector3>Vector3</a>
</td></tr>
</table>
</p>



<a name="spaceID"></a><p class="attribute_definition">
<span class="attribute_definition">spaceID</span>
</p>

<div class="attribute_description">This attribute is the ID of the <a href=../../keywords.html#Space>space</a> 
in which the entity is located. The cell and client ids are the same.
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>Read-only, Integer
</td></tr>
</table>
</p>



<a name="topSpeed"></a><p class="attribute_definition">
<span class="attribute_definition">topSpeed</span>
</p>

<div class="attribute_description">The maximum xz movement speed 
of the entity (m/s). This attribute is usually larger than the actualy 
movement speed. The server checks the client's movement legality through 
this attribute. If the movement distance excedes the speed limit, it is 
forced back to the previous position.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#topSpeedY">topSpeedY</a><br></td></tr>
</table>
</p>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>float
</td></tr>
</table>
</p>

<a name="topSpeedY"></a><p class="attribute_definition">
<span class="attribute_definition">topSpeedY</span>
</p>

<div class="attribute_description">The maximum y-axis movement speed 
of the entity (m/s). This attribute is usually larger than the actualy 
movement speed. The server checks the client's movement legality through 
this attribute. If the movement distance excedes the speed limit, it is 
forced back to the previous position.
</div>

<p>
<span class="attribute_links"><b>Other references:</b></span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td><a href=../../keywords.html#entity>Entity</a>.<a href="Entity.html#topSpeed">topSpeed</a><br></td></tr>
</table>
</p>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>float
</td></tr>
</table>
</p>




<a name="volatileInfo"></a><p class="attribute_definition">
<span class="attribute_definition">volatileInfo</span>
</p>

<div class="attribute_description">This attribute specifies the <a href=../../keywords.html#entity>Entity</a>'s 
volatile data synchronization policy.<br>
Volatile data includes the coordinate position of the entity and the 
orientation of the entity. Since volatile data is easily changed, the 
engine uses a set of optimized solutions to synchronize it to the 
client.<br>
This attribute is four floats (position, yaw, pitch, roll) that represents 
the distance value, and the server synchronizes the relevant data to it 
when an entity reaches a close distance. If the distance value is larger 
than the View radius, it means that it is always synchronized
<br><br>
There is also a special bool attribute that is optimized. Its role is to 
control whether or not the server is optimized for synchronization. The 
current main optimization is the Y axis.<br>
If true, the server does not synchronize the y-axis coordinates of the 
entity when some actions (e.g., navigate) cause the server to determine 
the entity is on the ground. This can save a lot of bandwidth when 
synchronizing a large number of entities. The default is true.<br>

<br><br>
Users can also set the synchronization policies for different entities in .def:

<pre>&lt;Volatile&gt;
    &lt;position/&gt;           &lt;!-- always synchronize --&gt;
    &lt;yaw/&gt;                &lt;!-- always synchronize --&gt;
    &lt;pitch&gt;20&lt;/pitch&gt;     &lt;!-- synchronize within 20m or less --&gt;
    &lt;optimized&gt; true &lt;/optimized&gt;   
&lt;/Volatile&gt;               &lt;!-- roll is always synchronized if not specified  --&gt;

</pre>
</div>

<p>
<span class="attribute_type">Type:</span>
<table border=0 cellpadding=0 cellspacing=3 style="margin-left: 20px;">
<tr><td>sequence, four floats (float, float, float, float)
</td></tr>
</table>
</p>


<hr>
<p class="copyrightFooter">Copyright KBEngine</p>
</body>
</html>
